/*
 * @lc app=leetcode id=164 lang=cpp
 *
 * [164] Maximum Gap
 */
class Solution {
public:
    int maximumGap(vector<int>& nums) {
        int len = nums.size();
        if (len < 2) {
            return 0;
        }

        int gap = 0;
        int maxGap = 0;

        for (int i=1; i<len; i++) {
            gap = nums[i] - nums[i-1];
            if (gap > maxGap) { 
                maxGap = gap;
            }
        }

        return maxGap;
    }
};

